home *** CD-ROM | disk | FTP | other *** search
/ Star Trek Starfleet Academy Mini Omnipedia / MINI_OMNI.ISO / pc / omni_v2.dxr / 00388_Style Manager.ls < prev    next >
Encoding:
Text File  |  1996-04-15  |  5.0 KB  |  187 lines

  1. global gGlobalStepCount, gcurrentfullrecord, oIndexScroller, gPreStyledFlag, gdescfieldscriptcast, gdescfield, gOurFontK, gStyleCountThreshold, gStyleProgressCount, gHotLinkList, gMACListenStatus, oTextScroller, gIndxScrollFldK, gchunksize, gFirstHotWord, gModeState, gdescfieldspr, gKeyCount, gPrevWord, gkeylist, gStylingNeedF, gWordStyleCount, gStylePermitF
  2.  
  3. on hPrepStyles pthefld
  4.   put " " into field pthefld
  5.   set the textFont of field pthefld to gOurFontK
  6.   set the textStyle of field pthefld to "plain"
  7. end
  8.  
  9. on hResetDescFld
  10.   set gdescfield to the number of cast "F1"
  11.   set the castNum of sprite gdescfieldspr to gdescfield
  12.   updateStage()
  13. end
  14.  
  15. on hPrepIndexList parm
  16.   global gkeylist
  17.   set gkeylist to []
  18.   sort(gkeylist)
  19.   if parm = EMPTY then
  20.   end if
  21.   do("set gKeylist=[" & parm & "]")
  22.   set gKeyCount to count(gkeylist)
  23.   hMakeHotLinkList()
  24. end
  25.  
  26. on hMakeHotLinkList
  27.   set gHotLinkList to [:]
  28.   repeat with i = 1 to gKeyCount
  29.     set Lstyletype to getAt(getAt(gkeylist, i), 2)
  30.     if (Lstyletype = #b) or (Lstyletype = #bi) then
  31.       set Lchunksize to getAt(getAt(gkeylist, i), 1)
  32.       set Lfirstword to getPropAt(gkeylist, i)
  33.       repeat with n = 1 to Lchunksize
  34.         addProp(gHotLinkList, Lfirstword + n - 1, i)
  35.       end repeat
  36.     end if
  37.   end repeat
  38. end
  39.  
  40. on hSetStylingNeed pX
  41.   set gStylingNeedF to pX
  42. end
  43.  
  44. on hSetStylePermit pX
  45.   set gStylePermitF to pX
  46. end
  47.  
  48. on hSetFormat
  49.   set tidl to the itemDelimiter
  50.   set the itemDelimiter to RETURN
  51.   set the textStyle of item 2 of field gdescfield to "plain"
  52.   set the itemDelimiter to tidl
  53.   if gKeyCount > 0 then
  54.     set gWordStyleCount to 0
  55.     set gStyleProgressCount to 0
  56.     set gStyleCountThreshold to 225
  57.     hSetStylingNeed(1)
  58.   end if
  59. end
  60.  
  61. on hStyleMe
  62.   if not gStylePermitF then
  63.     return 
  64.   end if
  65.   hSysAlert(#null)
  66.   hWinVoiceMicOff()
  67.   repeat while not (the mouseDown)
  68.     if not gStylePermitF then
  69.       exit repeat
  70.     end if
  71.     if gWordStyleCount >= gKeyCount then
  72.       set LimDone to 1
  73.       hSetStylingNeed(0)
  74.       hSetStylePermit(0)
  75.       hSysAlert(#LCARSREADY)
  76.       hWinVoiceMicOn()
  77.       exit repeat
  78.     else
  79.       set LimDone to 0
  80.     end if
  81.     set gWordStyleCount to gWordStyleCount + 1
  82.     set i to gWordStyleCount
  83.     if gStyleProgressCount >= gStyleCountThreshold then
  84.       hSetStylingNeed(0)
  85.       hSysAlert(#LCARSREADY)
  86.       hWinVoiceMicOn()
  87.       exit repeat
  88.     end if
  89.     set W1 to getPropAt(gkeylist, i)
  90.     set wordinfo to getAt(gkeylist, i)
  91.     set LsavetoLexF to 0
  92.     set numwords to getAt(wordinfo, 1)
  93.     set wordstyle to getAt(wordinfo, 2)
  94.     if wordstyle = #b then
  95.       hDoTheStyle(W1, numwords, "bold", 1)
  96.       next repeat
  97.     end if
  98.     if wordstyle = #i then
  99.       hDoTheStyle(W1, numwords, "italic", 0)
  100.       next repeat
  101.     end if
  102.     if wordstyle = #bi then
  103.       hDoTheStyle(W1, numwords, "bold, italic", 1)
  104.       next repeat
  105.     end if
  106.     if wordstyle = #u then
  107.       hDoTheStyle(W1, numwords, "underline", 0)
  108.       next repeat
  109.     end if
  110.     if wordstyle = #p then
  111.       hDoTheStyle(W1, numwords, "plain", 0)
  112.       next repeat
  113.     end if
  114.     if wordstyle = #iu then
  115.       hDoTheStyle(W1, numwords, "italic,underline", 0)
  116.     end if
  117.   end repeat
  118.   if gMACListenStatus then
  119.     hAppendLinkstoLanguage()
  120.   end if
  121.   hShowEmbeddedHits()
  122.   hSysAlert(#LCARSREADY)
  123.   return LimDone
  124. end
  125.  
  126. on hDoTheStyle pw1, pNofW, pWS, pSaveFlag
  127.   set wLast to pw1 + pNofW - 1
  128.   set the textStyle of word pw1 to wLast of field gdescfield to pWS
  129.   if gMACListenStatus and (pSaveFlag = 1) then
  130.     hAppendLexicon(pw1, wLast)
  131.   end if
  132.   set gStyleProgressCount to wLast
  133. end
  134.  
  135. on hDisplayEntryname theitem
  136.   set fieldpointer to char 1 of theitem
  137.   if (fieldpointer < 1) or (fieldpointer > 6) then
  138.     return 
  139.   end if
  140.   delete char 1 of theitem
  141.   set tidl to the itemDelimiter
  142.   set the itemDelimiter to RETURN
  143.   put theitem into item value(fieldpointer) of field gdescfield
  144.   put RETURN after field gdescfield
  145.   set the itemDelimiter to tidl
  146. end
  147.  
  148. on hDisplayBodyText thetext
  149.   set tidl to the itemDelimiter
  150.   set the itemDelimiter to "@"
  151.   set Lcode to char 1 of item 1 of thetext
  152.   delete char 1 of item 1 of thetext
  153.   set the itemDelimiter to RETURN
  154.   put thetext into item value(Lcode) of field gdescfield
  155.   set the itemDelimiter to tidl
  156.   mStoreMyInfo(oTextScroller, gdescfield)
  157.   mAdjustTopHopper(oTextScroller)
  158. end
  159.  
  160. on hDisplayPrestyledTxt
  161.   set the castNum of sprite gdescfieldspr to gPreStyledFlag
  162.   set gdescfield to gPreStyledFlag
  163.   updateStage()
  164.   mStoreMyInfo(oTextScroller, gdescfield)
  165.   mAdjustTopHopper(oTextScroller)
  166.   set gWordStyleCount to gKeyCount
  167.   hSetStylingNeed(0)
  168.   hSetStylePermit(0)
  169.   if gMACListenStatus then
  170.     hAppendLexiconfromList(value(field (gPreStyledFlag + 1)))
  171.   end if
  172. end
  173.  
  174. on hHiliteItem pNumb
  175.   if pNumb = 0 then
  176.     set the textStyle of field gIndxScrollFldK to "plain"
  177.   else
  178.     if pNumb <> the iPrevHL of oIndexScroller then
  179.       set the textStyle of field gIndxScrollFldK to "plain"
  180.     end if
  181.     if (pNumb > 0) and (pNumb <= the iColHeightK of oIndexScroller) then
  182.       set the textStyle of line pNumb of field gIndxScrollFldK to "bold"
  183.       set the iPrevHL of oIndexScroller to pNumb
  184.     end if
  185.   end if
  186. end
  187.